package cn.huiyunche.bms.backend.service;

import cn.huiyunche.bms.backend.bo.ReceivableFeeDetailorTempBO;
import cn.huiyunche.bms.backend.query.BmsReceivableBillConditions;
import cn.huiyunche.bms.backend.query.SServiceOrderConditions;
import cn.huiyunche.bms.base.model.SServiceOrderWithReceivable;
import cn.huiyunche.commons.domain.PageVo;
import org.springframework.validation.BindingResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * Created by Felix on 2017/7/6 9527.
 */
public interface ReceivableService {

    /**
     * 根据条件查询应收账单列表
     * @param pageVo
     * @param conditions
     * @return
     * @throws Exception
     */
    Map<String, Object> selectReceivableByConditions(PageVo pageVo, BmsReceivableBillConditions conditions) throws Exception;

    /**
     * 根据条件查询应收订单列表
     * @param pageVo
     * @param conditions
     * @return
     * @throws Exception
     */
    Map<String, Object> selectServiceOrderByConditions(PageVo pageVo, SServiceOrderConditions conditions) throws Exception;

    /**
     * 插入应收费用明细临时表
     * @param orderIds
     * @throws Exception
     */
    String insertTemp(List orderIds) throws Exception;

    /**
     * 根据条件查询应收费用明细临时列表
     * @param versionNo
     * @return
     * @throws Exception
     */
    Map<String, Object> selectReceivableDetailTemp(String versionNo) throws Exception;

    /**
     * 生成账单
     * @param versionNo
     * @param invoiceStatus
     * @throws Exception
     */
    void createRece(String versionNo, String invoiceStatus,String username) throws Exception;

    /**
     * 确认账单
     * @param billId
     * @throws Exception
     */
    Integer confirmBill(Integer billId, String invoiceStatus) throws  Exception;

    /**
     * 根据条件查询应收订单列表
     * @param pageVo
     * @param billId
     * @return
     * @throws Exception
     */
    Map<String, Object> selectReceivableDetailByConditions(PageVo pageVo, Integer billId) throws Exception;

    /**
     * 修改应收账单明细临时表信息
     * @param bo
     * @param br
     * @return
     * @throws Exception
     */
    Integer updateReceivableDetailTemp(ReceivableFeeDetailorTempBO bo, BindingResult br) throws Exception;

    /**
     * 修改应收账单明细信息
     * @param bo
     * @param br
     * @return
     * @throws Exception
     */
    Integer updateReceivableDetail(ReceivableFeeDetailorTempBO bo, BindingResult br) throws Exception;

    /**
     * 删除账单
     * @param ids
     * @return
     * @throws Exception
     */
    Integer deleteReceivable(List<Integer> ids) throws Exception;

    /**
     * 移除明细账单的订单
     * @param id
     * @return
     * @throws Exception
     */
    Integer deleteReceivableDetail(Integer id) throws Exception;

    /**
     * 移除明细账单的临时订单
     * @param id
     * @return
     * @throws Exception
     */
    Integer deleteReceivableDetailTemp(Integer id) throws Exception;

    /**
     * 查询客户
     * @return
     * @throws Exception
     */
    List<SServiceOrderWithReceivable> selectConsignorName() throws Exception;

    /**
     * 确认收款
     * @param billId
     * @param invoiceDateString
     * @param payeeDateString
     * @return
     * @throws Exception
     */
    Integer confirmProceed(Integer billId, String invoiceDateString, String payeeDateString, String username) throws Exception;

    /**
     * 导出excel
     * @param orderIds
     * @return
     * @throws Exception
     */
    void exportExcel(List orderIds, HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 收款确认导出excel
     * @param orderIds
     * @return
     * @throws Exception
     */
    void exportProceed(List orderIds, HttpServletRequest request, HttpServletResponse response) throws Exception;
}
